package models

import "time"

type Intention struct {
	Intention string     `json:"intention"` //用户需求概述
	Funcs     []struct { //子功能列表
		Name        string `json:"name"`
		Description string `json:"description"`
		Input       string `json:"input"`
		Output      string `json:"output"`
	} `json:"func"`
	Language string `json:"language"`
}

// IntentionMessage 用户意图分析消息
type IntentionMessage struct {
	Intention Intention `json:"intention"`
	Ok        bool      `json:"ok"`
}

type Workflow struct {
	Workflow  string `json:"workflow"`
	Dataflows []struct {
		ID          uint   `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		Input       string `json:"input"`
		Output      string `json:"output"`
		JumpList    []struct {
			Condition string `json:"condition"`
			ID        uint   `json:"id"`
		} `json:"jump-list"`
	} `json:"dataflows"`
	Language string `json:"language"`
}

type WorkflowMessage struct {
	Workflow Workflow `json:"workflow"`
	Ok       bool     `json:"ok"`
}

// 历史记录相关
type UserIntentionItem struct {
	ID        uint      `json:"id"`
	Intention string    `json:"intention"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type DataflowItem struct {
	ID uint `json:"id"`
}

type History struct {
	UserID uint          `json:"user_id"`
	Items  []HistoryItem `json:"history_items"`
}

type HistoryItem struct {
	IntentionID uint      `json:"intention_id"  gorm:"column:intention_id"`
	DataflowID  uint      `json:"dataflow_id" gorm:"column:dataflow_id"`
	Intention   string    `json:"intention"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}
